# 预设正确的账号和密码
correct_username = "123"
correct_password = "456"

# 初始化尝试次数（最多3次）
attempts = 3

while attempts > 0:
    # 获取用户输入
    username = input("请输入账号：")
    password = input("请输入密码：")
    
    # 验证账号密码
    if username == correct_username and password == correct_password:
        print("登录成功")
        break  # 验证通过，跳出循环
    else:
        attempts -= 1  # 尝试次数减1
        if attempts > 0:
            print(f"用户名或密码错误，您还有{attempts}次机会")
        else:
            print("输入错误次数过多，请稍后再试")